package com.ip.common.constant;

import com.ip.common.enums.CodeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * 分页结果封装类
 * @param <T> 数据类型
 */
@ApiModel
public class PageResult<T> extends Result<T> implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @ApiModelProperty(value = "总记录数")
    private long total;
    
    @ApiModelProperty(value = "当前页码")
    private int pageNo;
    
    @ApiModelProperty(value = "每页记录数")
    private int pageSize;
    
    @ApiModelProperty(value = "总页数")
    private int totalPages;
    
    public PageResult() {
        super();
    }
    
    public PageResult(CodeEnum codeEnum) {
        super(codeEnum);
    }
    
    public PageResult(CodeEnum codeEnum, T data) {
        super(codeEnum, data);
    }
    
    public PageResult(int code) {
        super(code);
    }
    
    public PageResult(int code, String msg) {
        super(code, msg);
    }
    
    public PageResult(int code, String msg, T data) {
        super(code, msg, data);
    }
    
    public PageResult(int code, T data) {
        super(code, data);
    }
    
    public PageResult(T data) {
        super(data);
    }
    
    public long getTotal() {
        return total;
    }
    
    public void setTotal(long total) {
        this.total = total;
    }
    
    public int getPageNo() {
        return pageNo;
    }
    
    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }
    
    public int getPageSize() {
        return pageSize;
    }
    
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    
    public int getTotalPages() {
        return totalPages;
    }
    
    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }
}